﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
using System.IO;

namespace Model
{
    public static class FileIOHelper
    {
        public static List<string> ReadText(string path)
        {
            StreamReader sr = new StreamReader(path);
            List<string> data = new List<string>();
            while (!sr.EndOfStream)
            {
                data.Add(sr.ReadLine());
            }
            sr.Close();
            return data;
        }
        public static void WriteText(List<string> data,string path)
        {
            StreamWriter sw = new StreamWriter(path, true, Encoding.Default);
            foreach(string s in data)
            {
                sw.WriteLine(s);
            }
            sw.Close();
        }

        public static async Task<AssetBundle> GetAssetBundle(string url)
        {
            return (await new WWW(url)).assetBundle;
        }

    }
}
